package com.zsw.dao;

import com.zsw.entity.Storage;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author zhangsw
 */
public interface StorageDao {

    /**
     * 更新库存
     * @param storage
     * @return
     */
    @Update("update storage set `count`=#{count} where commodityCode=#{commodityCode}")
    int updateStorage(Storage storage);

    /**
     * 根据商品Id查询库存
     * @param commodityCode
     * @return
     */
    @Select("select id,commodityCode,`count` from storage where commodityCode=#{commodityCode}")
    Storage selectStorageByCommodityCode(int commodityCode);
}
